<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: Dean <zxxjjforever@163.com>
// +----------------------------------------------------------------------
namespace api\home\controller;

use think\Db;
use cmf\controller\RestBaseController;
use think\Config;
class DoctorController extends RestBaseController
{
	public $data;
	public function __construct(){
		$this->data = input();
	}
	/**
	 * 医生列表
	 * 传参说明 
	 * page int 页数
	 * biz_id int 绑定小程序id
	 * token string 登陆凭证
	 * 返回说明 json
	 * msg string 文本说明
	 * toPage int 总页数
	 * toCount int 总条数 toCount 小于等于0时  代表没有数据
	 * list array 数据列表
	 **/
	public function list(){
		if(!isset($this->data['page'])||empty($this->data['page'])||$this->data['page']<=0){
			$this->data['page'] = 1;
		}
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		$where = ' 1 = 1 ';
		//查询逻辑
		if (isset($this->data['name'])||!empty($this->data['name'])) {  //姓名
			$where .= ' and name like \'%'.$this->data['name'].'%\' ';
		}
		if (isset($this->data['tel'])||!empty($this->data['tel'])) {  //电话
			$where .= ' and tel like \'%'.$this->data['tel'].'%\' ';
		}
		if (isset($this->data['positional_title'])||!empty($this->data['positional_title'])) { //职称 1医师 2主治医师 3副主任医师 4主任医师 5副教授 6教授
			$where .= ' and positional_title = '.$this->data['positional_title'].' ';
		}

		$page = $this->data['page'];
		$biz_id = $this->data['biz_id'];
		$toCount = Db::table('doctor')->where(['biz_id'=>$biz_id])->where($where)->count();
		$list = Db::table('doctor')->where(['biz_id'=>$biz_id,'delete_flag'=>0])->where($where)->limit(($page-1)*10,10)->order('id desc')->select();
		if($toCount<=0){
			$this->success('没有数据！',array());
		}
		$toPage = ceil($toCount/10);
		$this->success('success',['toPage'=>$toPage,'toCount'=>$toCount,'list'=>$list]);
	}
	/**
	 * 单个医生详情
	 * 传参说明
	 * doc_id int 医生ID
	 * biz_id int 绑定小程序id
	 * token string 登陆凭证
	 * 返回说明 json
	 **/
	public function info(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		$where['delete_flag'] = 0;
		if(input('template_id') && input('template_id') == 2){//如果是单个医生直接
			$where['biz_id'] = $this->data['biz_id'];
		}else{
			if (!isset($this->data['id'])||empty($this->data['id'])) {
				$this->error('缺少参数[id]');
			}
			$where['id'] = $this->data('id');
		}
		$biz_id = $this->data['biz_id'];
		$info = Db::table('doctor')->where($where)->find();
		if(!$info){
			$this->success('此医生不存在！');
		}else{
			$this->success('success',$info);
		}
	}
	/**
	 * 编辑医生
	 * 传参说明
	 * 所有字段均不能为空
	 * token string 登陆凭证
	 * 返回说明 json
	 **/
	public function update(){
		if(!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if(!isset($this->data['id'])||empty($this->data['id'])) {
			$this->error('缺少参数[id]');
		}
		if(!isset($this->data['name'])||empty($this->data['name'])){
			$this->error('医生姓名不能为空！');
		}
		if(!isset($this->data['headimg'])||empty($this->data['headimg'])){
			$this->error('请上传医生头像！');
		}
		if(!isset($this->data['tel'])||empty($this->data['tel'])){
			$this->error('手机号不能为空！');
		}
		if(!isset($this->data['isopen'])||empty($this->data['isopen'])){
			$this->error('手机号是否公开！');
		}
		if(!isset($this->data['profiles'])||empty($this->data['profiles'])){
			$this->error('医生简介不能为空！');
		}
		if(!isset($this->data['begoodat'])||empty($this->data['begoodat'])){
			$this->error('医生擅长不能为空！');
		}
		$rs = Db::table('doctor')->where(['biz_id'=>$this->data['biz_id'],'id'=>$this->data['id']])->update([
			'name' => $this->data['name'], //姓名
			'headimg' => $this->data['headimg'], //头像
			'tel' => $this->data['tel'], //电话
			'positional_title' => $this->data['positional_title'], //职称
			'hospital' => $this->data['hospital'], //医院
			'tel' => $this->data['tel'], //电话
			'isopen' => $this->data['isopen'], //是否公开电话
			'profiles' => $this->data['profiles'], //医生简介
			'begoodat' => $this->data['begoodat'], //擅长
			'update_time' => time()
		]);
		if($rs){
			$this->success('更新成功！');
		}else{
			$this->error('更新失败！');
		}
	}
	/**
	 * 添加医生
	 * 所有字段均不能为空
	 * token string 登陆凭证
	 * 返回说明 json
	 **/
	public function add(){
		if(!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if(!isset($this->data['name'])||empty($this->data['name'])){
			$this->error('医生姓名不能为空！');
		}
		if(Db::table('doctor')->where(['name'=>$this->data['name']])->count()>0){
			$this->error('此医生已存在！');
		}
		if(!isset($this->data['headimg'])||empty($this->data['headimg'])){
			$this->error('请上传医生头像！');
		}
		if(!isset($this->data['tel'])||empty($this->data['tel'])){
			$this->error('手机号不能为空！');
		}
		if(!isset($this->data['isopen'])||empty($this->data['isopen'])){
			$this->error('手机号是否公开！');
		}
		if(!isset($this->data['profiles'])||empty($this->data['profiles'])){
			$this->error('医生简介不能为空！');
		}
		if(!isset($this->data['begoodat'])||empty($this->data['begoodat'])){
			$this->error('医生擅长不能为空！');
		}
		if(!isset($this->data['positional_title'])||empty($this->data['positional_title'])){
			$this->error('职称不能为空!');
		}
		if(!isset($this->data['hospital'])||empty($this->data['positional_title'])){
			$this->error('医院名称不能为空！');
		}
		$rs = Db::table('doctor')->insert([
			'biz_id' => $this->data['biz_id'], //绑定id
			'name' => $this->data['name'], //姓名
			'headimg' => $this->data['headimg'], //头像
			'tel' => $this->data['tel'], //电话
			'positional_title' => $this->data['positional_title'], //职称
			'hospital' => $this->data['hospital'], //医院
			'tel' => $this->data['tel'], //电话
			'isopen' => $this->data['isopen'], //是否公开电话
			'profiles' => $this->data['profiles'], //医生简介
			'begoodat' => $this->data['begoodat'], //擅长
			'create_time' => time()
		]);
		if($rs){
			$this->success('添加成功！');
		}else{
			$this->error('添加失败！');
		}
	}
	/**
	 * 删除医生
	 * doc_id int 医生ID
	 * biz_id int 绑定小程序id
	 **/
	public function del(){
		if(!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if(!isset($this->data['id'])||empty($this->data['id'])) {
			$this->error('缺少参数[id]');
		}
		Db::table('doctor')->where(['biz_id'=>$this->data['biz_id'],'id'=>$this->data['id']])->delete();
		$this->success('删除成功！');
	}

	#######################
	#就诊地点 字段集中说明
	#biz_id 小程序绑定id
	#name 就诊地点名称
	#province 省
	#city 市
	#county 县
	#info 详细地址
	#info 详细地址
	#info 详细地址
	#lng 经度
	#lat 纬度
	#addtime 添加时间
	#updatetime 修改时间
	
	/**
	 * 就诊地点--列表
	 * 传参说明
	 * biz_id int 绑定小程序id
	 * 返回说明
	 * msg string 文本说明
	 * toPage int 总页数
	 * toCount int 总条数 toCount 小于等于0时  代表没有数据
	 * list array 数据列表
	 **/
	public function visit(){
		if(!isset($this->data['page'])||empty($this->data['page'])||$this->data['page']<=0){
			$this->data['page'] = 1;
		}
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		$page = $this->data['page'];
		$biz_id = $this->data['biz_id'];
		$toCount = Db::table('visit_address')->where(['biz_id'=>$biz_id])->count();
		$list = Db::table('visit_address')->where(['biz_id'=>$biz_id])->limit(($page-1)*10,10)->order('id desc')->select();
		if($toCount<=0){
			$this->success('没有数据！',array(),['toCount'=>$toCount]);
		}
		$toPage = ceil($toCount/10);
		$this->success('success',['toPage'=>$toPage,'toCount'=>$toCount,'list'=>$list]);
	}
	/**
	 * 就诊地点--详情
	 * 传参说明
	 * biz_id int 绑定小程序id
	 * token string 登陆凭证
	 * 返回说明 json
	 **/
	public function visit_info(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if (!isset($this->data['id'])||empty($this->data['id'])) {
			$this->error('缺少参数[id]');
		}
		$biz_id = $this->data['biz_id'];
		$info = Db::table('visit_address')->where(['biz_id'=>$biz_id,'id'=>$this->data['id']])->find();
		if(!$info){
			$this->success('此就诊地点不存在！');
		}else{
			$this->success('success',$info);
		}
	}
	/**
	 * 更新就诊地点
	 * 传参说明
	 * biz_id int 绑定小程序id
	 * id
	 **/
	public function visit_update(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if (!isset($this->data['id'])||empty($this->data['id'])) {
			$this->error('缺少参数[id]');
		}
		if (!isset($this->data['name'])||empty($this->data['name'])) {
			$this->error('就诊地点不能为空！');
		}
		if (!isset($this->data['province'])||empty($this->data['province'])) {
			$this->error('请选择省份！');
		}
		// if (!isset($this->data['city'])||empty($this->data['city'])) {
		// 	$this->error('清选择城市！');
		// }
		if (!isset($this->data['city'])||empty($this->data['city'])) {
			$this->error('清选择城市！');
		}
		if (!isset($this->data['county'])||empty($this->data['county'])) {
			// $this->error('请选择县城！');  #考虑到可能不存在  不验证
		}
		if (!isset($this->data['info'])||empty($this->data['info'])) {
			$this->error('请输入详细地址！');
		}
		// if (!isset($this->data['lat'])||empty($this->data['lat'])) {
		// 	$this->error('纬度数据丢失！');
		// }
		// if (!isset($this->data['lng'])||empty($this->data['lng'])) {
		// 	$this->error('经度数据丢失！');
		// }
		$biz_id = $this->data['biz_id'];
		$info = Db::table('visit_address')->where(['biz_id'=>$biz_id,'id'=>$this->data['id']])->update([
			'name'=>$this->data['name'],
			'province'=>$this->data['province'],
			'city'=>$this->data['city'],
			'county'=>$this->data['county'],
			// 'lat'=>$this->data['lat'],
			// 'lng'=>$this->data['lng'],
			'info'=>$this->data['info'],
			'addtime'=>time()
		]);
		if(!$info){
			$this->success('此就诊地点不存在！');
		}else{
			$this->success('修改成功！',$info);
		}
	}
	/**
	 * 更新就诊地点
	 * 传参说明
	 * biz_id int 绑定小程序id
	 * id
	 **/
	public function visit_add(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if (!isset($this->data['name'])||empty($this->data['name'])) {
			$this->error('就诊地点不能为空！');
		}
		if (!isset($this->data['province'])||empty($this->data['province'])) {
			$this->error('请选择省份！');
		}
		if (!isset($this->data['city'])||empty($this->data['city'])) {
			$this->error('清选择城市！');
		}
		// if (!isset($this->data['city'])||empty($this->data['city'])) {
		// 	$this->error('清选择城市！');
		// }
		if (!isset($this->data['county'])||empty($this->data['county'])) {
			// $this->error('请选择县城！');  #考虑到可能不存在  不验证
		}
		if (!isset($this->data['info'])||empty($this->data['info'])) {
			$this->error('请输入详细地址！');
		}
		// if (!isset($this->data['lat'])||empty($this->data['lat'])) {
		// 	$this->error('纬度数据丢失！');
		// }
		// if (!isset($this->data['lng'])||empty($this->data['lng'])) {
		// 	$this->error('经度数据丢失！');
		// }
		$biz_id = $this->data['biz_id'];
		$info = Db::table('visit_address')->insert([
			'biz_id'=>$biz_id,
			'name'=>$this->data['name'],
			'province'=>$this->data['province'],
			'city'=>$this->data['city'],
			'county'=>$this->data['county'],
			// 'lat'=>$this->data['lat'],
			// 'lng'=>$this->data['lng'],
			'info'=>$this->data['info'],
			'addtime'=>time()
		]);
		if(!$info){
			$this->success('添加就诊地点失败！');
		}else{
			$this->success('新增成功！',$info);
		}
	}
	/**
	 * 删除就诊地点
	 * 传参说明
	 * biz_id int 绑定小程序id
	 * id
	 **/
	public function visit_del(){
		if(!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if(!isset($this->data['id'])||empty($this->data['id'])) {
			$this->error('缺少参数[id]');
		}
		Db::table('visit_address')->where(['biz_id'=>$this->data['biz_id'],'id'=>$this->data['id']])->delete();
		$this->success('删除成功！');
	}

	#helper 医生助手字段说明
	#id 自增id
	#biz_id 小程序id
	#doc_id 医生id
	#dname 医生名字
	#name 助手名字
	#tel 电话
	#addtime 添加时间
	#updatetime 更新时间
	/**
	 * 助手列表  针对只有一个医生
	 **/
	public function helper_list(){
		if(!isset($this->data['page'])||empty($this->data['page'])||$this->data['page']<=0){
			$this->data['page'] = 1;
		}
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}

		if (!isset($this->data['doc_id'])||empty($this->data['doc_id'])) {
			$this->error('缺少参数[doc_id]');
		}
			
		$page = $this->data['page'];

		$biz_id = $this->data['biz_id'];

		$where['doc_id'] = $this->data['doc_id'];
		$where['biz_id'] = $this->data['biz_id'];
		$toCount = Db::table('helper')->where($where)->count();
		$list = Db::table('helper')->
			where($where)->limit(($page-1)*10,10)->order('id desc')->select();
		if($toCount<=0){
			$this->success('没有数据！',array(),['toCount'=>$toCount]);
		}
		$toPage = ceil($toCount/10);
		$this->success('success',$list);
	}
	/**
	 * 助手列表  针对多个医生  有查询功能、医生
	 * 以医生为主表  助手为附表
	 **/
	public function helper_listtwo(){
		if(!isset($this->data['page'])||empty($this->data['page'])||$this->data['page']<=0){
			$this->data['page'] = 1;
		}
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		$page = $this->data['page'];
		$biz_id = $this->data['biz_id'];

		$where = ' 1=1 ';

		if (isset($this->data['dname'])||!empty($this->data['dname'])) {  //这里  查询医生名字  key = dname
			$rs = Db::table('doctor')->field('id')->where(['biz_id'=>$this->data['biz_id'],'name'=>$this->data['dname']])->find();
			if(!$rs){
				$this->success('没有该医生数据！',array());
			}
			$where .= ' and id='.$rs['id'];
		}
		if (isset($this->data['name'])||!empty($this->data['name'])) { //这里  助手姓名  key = name
			$rs = Db::table('helper')->field('doc_id')->where(['biz_id'=>$this->data['biz_id'],'name'=>$this->data['name']])->find();
			if(!$rs){
				$this->success('没有该助手数据！',array());
			}
			$where .= ' and id='.$rs['doc_id'];
		}

		$toCount = Db::table('doctor')->
			where($where)->where(['biz_id'=>$this->data['biz_id']])->count();

		if($toCount<=0){
			$this->success('没有数据！',array(),['toCount'=>$toCount]);
		}
		
		$list = Db::table('doctor')->
			where($where)->where(['biz_id'=>$this->data['biz_id']])->limit(($page-1)*10,10)->order('id desc')->select();
		$lists = [];
		foreach ($list as $key => $value) {
			$value['helper'] = Db::table('helper')->where(' doc_id = '.$value['id'])->select();
			$lists[] = $value;
		}
		$toPage = ceil($toCount/10);
		$this->success('success',['toPage'=>$toPage,'toCount'=>$toCount,'list'=>$lists]);
	}
	/**
	 * 删除医生助手
	 * 传参说明
	 * biz_id int 绑定小程序id
	 * id
	 * doc_id 医生id
	 **/
	public function helper_del(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if (!isset($this->data['id'])||empty($this->data['id'])) {
			$this->error('缺少参数[id]');
		}
		if (!isset($this->data['doc_id'])||empty($this->data['doc_id'])) {
			$this->error('缺少参数[doc_id]');
		}
		Db::table('helper')->where(['biz_id'=>$this->data['biz_id'],'id'=>$this->data['id'],'doc_id'=>$this->data['doc_id']])->delete();
		$this->success('删除成功！');
	}

	/**
	 * 单条数据详情 医生助手 用于编辑
	 * biz_id 小程序模板ID
	 * id
	 * doc_id 医生ID
	 **/
	public function helper_info(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if (!isset($this->data['id'])||empty($this->data['id'])) {
			$this->error('缺少参数[id]');
		}
		if (!isset($this->data['doc_id'])||empty($this->data['doc_id'])) {
			$this->error('缺少参数[doc_id]');
		}
		$rs = Db::table('helper')->where(['biz_id'=>$this->data['biz_id'],'id'=>$this->data['id'],'doc_id'=>$this->data['doc_id']])->find();
		if(!$rs){
			$this->error('该数据不存在！');
		}
		$this->success('success',$rs);
	}
	/**
	 * 单条数据更新 医生助手
	 * biz_id 小程序模板ID
	 * id
	 * doc_id 医生ID
	 **/
	public function helper_update(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if (!isset($this->data['id'])||empty($this->data['id'])) {
			$this->error('缺少参数[id]');
		}
		if (!isset($this->data['doc_id'])||empty($this->data['doc_id'])) {
			$this->error('缺少参数[doc_id]');
		}
		if (!isset($this->data['name'])||empty($this->data['name'])) {
			$this->error('助手名字不能为空！');
		}
		if (!isset($this->data['tel'])||empty($this->data['tel'])) {
			$this->error('助手电话不能为空！');
		}
		$rs = Db::table('helper')->where(['biz_id'=>$this->data['biz_id'],'id'=>$this->data['id'],'doc_id'=>$this->data['doc_id']])->update([
			'name' => $this->data['name'],
			'tel' => $this->data['tel'],
			'updatetime' => time()
		]);
		if(!$rs){
			$this->error('更新失败！');
		}
		$this->success('更新成功！');
	}

	/**
	 * 单条数据添加 医生助手
	 * biz_id 小程序模板ID
	 * id
	 * doc_id 医生ID
	 **/
	public function helper_add(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if (!isset($this->data['doc_id'])||empty($this->data['doc_id'])) {
			$this->error('缺少参数[doc_id]');
		}
		if (!isset($this->data['name'])||empty($this->data['name'])) {
			$this->error('助手名字不能为空！');
		}
		if (!isset($this->data['tel'])||empty($this->data['tel'])) {
			$this->error('助手电话不能为空！');
		}
		$rs = Db::table('helper')->insert([
			'name' => $this->data['name'],
			'tel' => $this->data['tel'],
			'biz_id' => $this->data['biz_id'],
			'doc_id' => $this->data['doc_id'],
			'addtime' => time()
		]);
		if(!$rs){
			$this->error('添加失败！');
		}
		$this->success('添加成功！');
	}
	/**
	 * 医生头像/图片上传
	 **/
	public function upload(){
		$file = request()->file('image');
		if($file){
	        $info = $file->move(ROOT_PATH . 'public' . DS . 'upload' . DS . 'doctor');
	        if($info){
	            if( !in_array($info->getExtension(), ['png','jpg'])){
	            	$this->error('图片上传失败，只能上传jpg、png格式图片');
	            }
	            $this->success('success',Config::get('weburl').'/upload/doctor/'. DS .$info->getSaveName());
	        }else{
	           	$this->error('没有检测到上传的图片!');
	        }
	    }else{
	    	$this->error('请上传图片!');
	    }
	}

	############################################################################################
	##############################################医生服务######################################
	############################################################################################
	/**
	 * 医生服务列表 -- 针对有多个医生
	 **/
	public function server_list(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if(!isset($this->data['page'])||empty($this->data['page'])||$this->data['page']<=0){
			$this->data['page'] = 1;
		}
		$page = $this->data['page'];
		$biz_id = $this->data['biz_id'];
		$toCount = Db::table('doctor')->where(['biz_id'=>$biz_id])->count();
		if($toCount<=0){
			$this->success('没有数据！',['toCount'=>$toCount]);
		}
		$list = Db::table('doctor')->field('a.name,a.tel,a.id,b.*')->alias('a')->prefix_close()->
			join('doctor_server b','a.id = b.doc_id','left')->where(['a.biz_id'=>$biz_id])->
			limit(($page-1)*10,10)->order('b.id desc')->select();
		$toPage = ceil($toCount/10);
		$this->success('success',['toPage'=>$toPage,'toCount'=>$toCount,'list'=>$list]);
	}
	/**
	 * 服务详情
	 **/
	public function server_info(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if (!isset($this->data['doc_id'])||empty($this->data['doc_id'])) {
			$this->error('缺少参数[doc_id]');
		}
		$rs = Db::table('doctor_server')->where(['biz_id'=>$this->data['biz_id'],'doc_id'=>$this->data['doc_id']])->find();
		if(!$rs){
			$this->success('该数据不存在！');
		}
		$this->success('success',$rs);
	}
	/**
	 * 添加编辑服务
	 **/
	public function server_update(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if (!isset($this->data['doc_id'])||empty($this->data['doc_id'])) {
			$this->error('缺少参数[doc_id]');
		}
		$flag  = true;
		if (!isset($this->data['id'])||empty($this->data['id'])) {
			$flag = false;
		}
		// 防止漏传参数id 造成数据错误
		if (!$flag) {
			$res = Db::table('doctor_server')->where(['doc_id'=>$this->data['doc_id'],'biz_id'=>$this->data['biz_id']])->find();
			if ($res){
				$flag = true;
				$this->data['id'] = $res['id'];
			}
		}
		if (!isset($this->data['tvalue'])||empty($this->data['tvalue'])) {
			$this->data['tvalue'] = 0.00;
		}
		if (!isset($this->data['dvalue'])||empty($this->data['dvalue'])) {
			$this->data['dvalue'] = 0.00;
		}
		if (!isset($this->data['yvalue'])||empty($this->data['yvalue'])) {
			$this->data['yvalue'] = 0.00;
		}
		if (!isset($this->data['pvalue'])||empty($this->data['pvalue'])) {
			$this->data['pvalue'] = 0.00;
		}
		if (!isset($this->data['hvalue'])||empty($this->data['hvalue'])) {
			$this->data['hvalue'] = 0.00;
		}
		if (!isset($this->data['tstatus'])||empty($this->data['tstatus'])) {
			$this->data['tstatus'] = 0;
		}
		if (!isset($this->data['dstatus'])||empty($this->data['dstatus'])) {
			$this->data['dstatus'] = 0;
		}
		if (!isset($this->data['ystatus'])||empty($this->data['ystatus'])) {
			$this->data['ystatus'] = 0;
		}
		if (!isset($this->data['pstatus'])||empty($this->data['pstatus'])) {
			$this->data['pstatus'] = 0;
		}
		if (!isset($this->data['hstatus'])||empty($this->data['hstatus'])) {
			$this->data['hstatus'] = 0;
		}
		if (!isset($this->data['tcount'])||empty($this->data['tcount'])) {
			$this->data['tcount'] = 0;
		}
		if (!isset($this->data['dcount'])||empty($this->data['dcount'])) {
			$this->data['dcount'] = 0;
		}
		if (!isset($this->data['ycount'])||empty($this->data['ycount'])) {
			$this->data['ycount'] = 0;
		}
		if (!isset($this->data['pcount'])||empty($this->data['pcount'])) {
			$this->data['pcount'] = 0;
		}
		if($flag){
			$data = $this->data;
			unset($data['id']);
			$data['updatetime'] = time();
			$rs = Db::table('doctor_server')->where(['id'=>$this->data['id'],'doc_id'=>$this->data['doc_id'],'biz_id'=>$this->data['biz_id']])->update($data);
		}else{
			$this->data['addtime'] = time();
			$rs = Db::table('doctor_server')->insert($this->data);
		}
		$this->success('更新成功！',$rs);
	}
	####################################################################################
	####################################################################################
	########################################设置########################################
	####################################################################################
	####################################################################################
	/**
	 * 首页设置详情
	 **/
	public function base_info(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		$list = Db::table('base_info')->where(['biz_id'=>$this->data['biz_id']])->find();
		if($list){
			$doctor = Db::table('doctor')->where(' id in ('.$list['tuijian_doctor'].'0) ')->select();
			$list['tuijian_doctor'] = $doctor;
			$list['slide'] = unserialize($list['slide']);
			$this->success('success',$list);
		}
		$this->success('还没有设置');
	}
	/**
	 * 首页设置更新
	 * slide 图片地址 地址,地址,
	 * tuijian_doctor 推荐医生 id,id,
	 **/
	public function base_update(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if (!isset($this->data['yuyue_server'])||empty($this->data['yuyue_server'])) {
			$this->data['yuyue_server'] = 0;
		}
		if (!isset($this->data['dianhua_server'])||empty($this->data['dianhua_server'])) {
			$this->data['dianhua_server'] = 0;
		}
		if (!isset($this->data['tuwen_server'])||empty($this->data['tuwen_server'])) {
			$this->data['tuwen_server'] = 0;
		}
		if (!isset($this->data['peizheng_server'])||empty($this->data['peizheng_server'])) {
			$this->data['peizheng_server'] = 0;
		}
		if (!isset($this->data['huiyaun_server'])||empty($this->data['huiyaun_server'])) {
			$this->data['huiyaun_server'] = 0;
		}
		if (!isset($this->data['jianjie_switch'])||empty($this->data['jianjie_switch'])) {
			$this->data['jianjie_switch'] = 0;
		}
		if (!isset($this->data['tuijian_doctor'])||empty($this->data['tuijian_doctor'])) {
			$this->data['tuijian_doctor'] = '';
		}
		if (!isset($this->data['home_title'])||empty($this->data['home_title'])) {
			$this->error('首页标题不能为空！');
		}
		if (!isset($this->data['ext_text'])||empty($this->data['ext_text'])) {
			$this->error('推广文案不能为空！');
		}
		if (!isset($this->data['slide'])||empty($this->data['slide'])) {
			$this->error('请上传轮播图片！');
		}
		$this->data['slide']=serialize($this->data['slide']);
		$rs = Db::table('base_info')->where(['biz_id'=>$this->data['biz_id']])->find();
		if($rs){
			$this->data['updatetime'] = time();
			Db::table('base_info')->where(['id'=>$rs['id']])->update($this->data);
		}else{
			$this->data['addtime'] = time();
			Db::table('base_info')->insert($this->data);
		}
		$this->success('更新成功！');
	}
	/**
	 * 医生列表
	 **/
	public function base_doctor(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		$list = Db::table('doctor')->where(['biz_id'=>$this->data['biz_id']])->select();
		if(count($list)>0){
			$this->success('success',$list);
		}
		$this->success('此模板还没有医生数据');
	}
	/**
	 * 轮播上传
	 **/
	public function slide_upload(){
		$file = request()->file('image');
		if($file){
	        $info = $file->move(ROOT_PATH . 'public' . DS . 'upload' . DS . 'slide');
	        if($info){
	            if( !in_array($info->getExtension(), ['png','jpg'])){
	            	$this->error('图片上传失败，只能上传jpg、png格式图片');
	            }
	            $this->success('上传成功！', Config::get('weburl').'/upload/slide'. DS .$info->getSaveName());
	        }else{
	           	$this->error('没有检测到上传的图片!');
	        }
	    }else{
	    	$this->error('未选择图片！');
	    }
	}
	####################################################################################
	####################################################################################
	###################################微信#支付########################################
	####################################################################################
	####################################################################################
	/**
	 * 支付设置详情
	 **/
	public function pay_info(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		$list = Db::table('paysetting')->where(['biz_id'=>$this->data['biz_id']])->find();
		if($list){
			$this->success('success',$list);
		}
		$this->success('还没有设置支付资料');
	}
	/**
	 * 支付数据更新
	 **/
	public function pay_update(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if (!isset($this->data['account'])||empty($this->data['account'])) {
			$this->error('微信支付商户号不能为空！');
		}
		if (!isset($this->data['apikey'])||empty($this->data['apikey'])) {
			$this->error('API密钥不能为空！');
		}
		if (!isset($this->data['code'])||empty($this->data['code'])) {
			$this->error('证书编号不能为空！');
		}
		if (!isset($this->data['file'])||empty($this->data['file'])) {
			$this->error('请上传证书文件！');
		}
		if (!isset($this->data['tofv'])||empty($this->data['tofv'])) {
			$this->error('请选择证书有效时间！');
		}
		if(Db::table('paysetting')->where(['biz_id'=>$this->data['biz_id']])->find()){
			$this->data['updatetime'] = time();
			Db::table('paysetting')->where(['biz_id'=>$this->data['biz_id']])->update($this->data);
		}else{
			$this->data['addtime'] = time();
			Db::table('paysetting')->insert($this->data);
		}
		$this->success('更新成功！');
	}
	/**
	 * 上传证书文件
	 **/
	public function pay_upload(){
		$file = request()->file('file');
		if($file){
	        $info = $file->move(ROOT_PATH . 'public' . DS . 'upload' . DS . 'pay');
	        if($info){
	            if( !in_array($info->getExtension(), ['pem','pem'])){
	            	$this->error('证书文件格式错误！');
	            }
	            $this->success('success',Config::get('weburl').'/upload/pay'. DS .$info->getSaveName());
	        }else{
	           	$this->error('没有检测到上传的图片!');
	        }
	    }
	}
	########################################
	##################医院##################
	########################################
	/**
	 * 医院详情
	 **/
	public function hospital_info(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		$list = Db::table('hospital')->where(['biz_id'=>$this->data['biz_id']])->find();
		if($list){
			$list['info'] = unserialize($list['info']);
			$this->success('success',$list);
		}
		$this->success('没有数据！');
	}
	/**
	 * 详情更新
	 * info 字段例子
	 * #[
	 * #{"type":2,"context":"https://qncdn.ocoplus.com/o_1cg978ccn1cl017r518jk1qqb14ho32.png"},
	 * #{"type":1,"context":"33333333333"},
	 * #{"type":2,"context":"https://qncdn.ocoplus.com/o_1cg9790a9u2fguprq215hlua637.png"},
	 * #{"type":1,"context":"33333333333333333333"}
	 * #]
	 **/
	public function hospital_update(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if (!isset($this->data['name'])||empty($this->data['name'])) {
			$this->error('医院名称不能为空！');
		}
		if (!isset($this->data['banner'])||empty($this->data['banner'])) {
			$this->error('请上传banner图！');
		}
		if (!isset($this->data['jianjie'])||empty($this->data['jianjie'])) {
			$this->error('医院简介不能为空！');
		}
		if (!isset($this->data['logo'])||empty($this->data['logo'])) {
			$this->data['logo'] = '';
		}
		if (!isset($this->data['tel'])||empty($this->data['tel'])) {
			$this->data['tel'] = '';
		}
		if (!isset($this->data['info'])||empty($this->data['info'])) {
			$this->data['info'] = '';
		}
		if (!isset($this->data['share_text'])||empty($this->data['share_text'])) {
			$this->data['share_text'] = '';
		}
		$this->data['info'] = serialize($this->data['info']);
		$rs = Db::table('hospital')->where(['biz_id'=>$this->data['biz_id']])->find();
		if ($rs) {
			$this->data['updatetime'] = time();
			Db::table('hospital')->where(['biz_id'=>$this->data['biz_id']])->update($this->data);
		}else{
			$this->data['addtime'] = time();
			Db::table('hospital')->insert($this->data);
		}
		$this->success('更新成功！');
	}
	/**
	 * 上传logo
	 **/
	public function hospital_upload(){
		$file = request()->file('file');
		if($file){
	        $info = $file->move(ROOT_PATH . 'public' . DS . 'upload' . DS . 'logo');
	        if($info){
	            if( !in_array($info->getExtension(), ['pem','pem'])){
	            	$this->error('证书文件格式错误！');
	            }
	            $this->success('success',Config::get('weburl').'upload/logo/'. DS .$info->getSaveName());
	        }else{
	           	$this->error('没有检测到上传的图片!');
	        }
	    }
	}
	/**
	 * 上传图文详情图片
	 **/
	public function hospital_info_upload(){
		$file = request()->file('file');
		if($file){
	        $info = $file->move(ROOT_PATH . 'public' . DS . 'upload' . DS . 'info');
	        if($info){
	            if( !in_array($info->getExtension(), ['pem','pem'])){
	            	$this->error('证书文件格式错误！');
	            }
	            $this->success('success',Config::get('weburl').'upload'. DS .$info->getSaveName());
	        }else{
	           	$this->error('没有检测到上传的图片!');
	        }
	    }
	}
	########################################
	##################客服##################
	########################################
	/**
	 * 客服列表
	 **/
	public function kefu_list(){
		if(!isset($this->data['page'])||empty($this->data['page'])||$this->data['page']<=0){
			$this->data['page'] = 1;
		}
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		$page = $this->data['page'];
		$biz_id = $this->data['biz_id'];
		$toCount = Db::table('kefu')->where(['biz_id'=>$biz_id])->count();
		$list = Db::table('kefu')->where(['biz_id'=>$biz_id])->limit(($page-1)*10,10)->order('id desc')->select();
		if($toCount<=0){
			$this->success('没有数据！',['toCount'=>$toCount]);
		}
		$toPage = ceil($toCount/10);
		$this->success('success',['toPage'=>$toPage,'toCount'=>$toCount,'list'=>$list]);
	}
	/**
	 * 客服删除
	 **/
	public function kefu_del(){
		if(!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if(!isset($this->data['id'])||empty($this->data['id'])) {
			$this->error('缺少参数[id]');
		}
		Db::table('kefu')->where(['biz_id'=>$this->data['biz_id'],'id'=>$this->data['id']])->delete();
		$this->success('删除成功！');
	}
	/**
	 * 客服详情
	 **/
	public function kefu_info(){
		if(!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if(!isset($this->data['id'])||empty($this->data['id'])) {
			$this->error('缺少参数[id]');
		}
		$list = Db::table('kefu')->where(['biz_id'=>$this->data['biz_id'],'id'=>$this->data['id']])->find();
		if($list){
			$this->success('success',$list);
		}
		$this->error('没有数据！');
	}
	/**
	 * 客服添加
	 **/
	public function kefu_add(){
		if(!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if (!isset($this->data['tel'])||empty($this->data['tel'])) {
			$this->error('电话不能为空！');
		}
		if (!isset($this->data['beizhu'])||empty($this->data['beizhu'])) {
			$this->data['beizhu'] = '';
		}
		if(Db::table('kehu')->where(['tel'=>$this->data['tel']])->find()){
			$this->error('客服电话已存在！');
		}
		Db::table('kefu')->insert($this->data);
		$this->success('添加成功！');
	}
	/**
	 * 客服更新
	 **/
	public function kefu_update(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if (!isset($this->data['id'])||empty($this->data['id'])) {
			$this->error('缺少参数[id]');
		}
		if (!isset($this->data['tel'])||empty($this->data['tel'])) {
			$this->error('电话不能为空！');
		}
		if (!isset($this->data['beizhu'])||empty($this->data['beizhu'])) {
			$this->data['beizhu'] = '';
		}
		$this->data['updatetime'] = time();
		$rs = Db::table('kefu')->where(['biz_id'=>$this->data['biz_id'],'id'=>$this->data['id']])->update($this->data);
		if(!$rs){
			$this->error('更新失败！');
		}
		$this->success('更新成功！');
	}
	########################################
	##################门诊部################
	########################################
	/**
	 * 门诊部列表
	 **/
	public function poi_list(){
		if(!isset($this->data['page'])||empty($this->data['page'])||$this->data['page']<=0){
			$this->data['page'] = 1;
		}
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		$page = $this->data['page'];
		$biz_id = $this->data['biz_id'];
		$toCount = Db::table('hospitalpoi')->where(['biz_id'=>$biz_id])->count();
		$list = Db::table('hospitalpoi')->where(['biz_id'=>$biz_id])->limit(($page-1)*10,10)->order('poiid desc')->select();
		if($toCount<=0){
			$this->success('没有数据！',['toCount'=>$toCount]);
		}
		$toPage = ceil($toCount/10);
		$this->success('success',['toPage'=>$toPage,'toCount'=>$toCount,'list'=>$list]);
	}
	/**
	 * 门诊部添加
	 **/
	public function poi_add(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if (!isset($this->data['poiname'])||empty($this->data['poiname'])) {
			$this->error('门诊部名称不能为空！');
		}
		if (!isset($this->data['firstregion'])||empty($this->data['firstregion'])) {
			$this->error('请选择省市区！');
		}
		if (!isset($this->data['detailregion'])||empty($this->data['detailregion'])) {
			$this->error('请填写详细地址！');
		}
		if (!isset($this->data['poitel'])||empty($this->data['poitel'])) {
			$this->error('请填写电话号码！');
		}
		if (!isset($this->data['longitude'])||empty($this->data['longitude'])) {
			$this->error('经度数据丢失！');
		}
		if (!isset($this->data['latitude'])||empty($this->data['latitude'])) {
			$this->error('纬度数据丢失！');
		}
		if(Db::table('hospitalpoi')->where(['poiname'=>$this->data['poiname']])->find()){
			$this->error('门诊部名称已存在！');
		}
		$this->data['addtime'] = time();
		if(Db::table('hospitalpoi')->insert($this->data)){
			$this->success('添加成功！');
		}
		$this->error('添加失败！');
	}
	/**
	 * 门诊部删除
	 **/
	public function poi_del(){
		if(!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if(!isset($this->data['poiid'])||empty($this->data['poiid'])) {
			$this->error('缺少参数[poiid]');
		}
		Db::table('hospitalpoi')->where(['biz_id'=>$this->data['biz_id'],'poiid'=>$this->data['poiid']])->delete();
		$this->success('删除成功！');
	}
	/**
	 * 门诊部详情
	 **/
	public function poi_info(){
		if(!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if(!isset($this->data['poiid'])||empty($this->data['poiid'])) {
			$this->error('缺少参数[poiid]');
		}
		$list = Db::table('hospitalpoi')->where(['biz_id'=>$this->data['biz_id'],'poiid'=>$this->data['poiid']])->find();
		if($list){
			$this->success('success',$list);
		}
		$this->error('没有数据！');
	}
	/**
	 * 门诊部更新
	 **/
	public function poi_update(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if(!isset($this->data['poiid'])||empty($this->data['poiid'])) {
			$this->error('缺少参数[poiid]');
		}
		if (!isset($this->data['poiname'])||empty($this->data['poiname'])) {
			$this->error('门诊部名称不能为空！');
		}
		if (!isset($this->data['firstregion'])||empty($this->data['firstregion'])) {
			$this->error('请选择省市区！');
		}
		if (!isset($this->data['detailregion'])||empty($this->data['detailregion'])) {
			$this->error('请填写详细地址！');
		}
		if (!isset($this->data['poitel'])||empty($this->data['poitel'])) {
			$this->error('请填写电话号码！');
		}
		if (!isset($this->data['longitude'])||empty($this->data['longitude'])) {
			$this->error('经度数据丢失！');
		}
		if (!isset($this->data['latitude'])||empty($this->data['latitude'])) {
			$this->error('纬度数据丢失！');
		}
		$this->data['updatetime'] = time();
		if(Db::table('hospitalpoi')->where(['poiid'=>$this->data['poiid']])->update($this->data)){
			$this->success('更新成功！');
		}
		$this->error('更新失败！');
	}
	########################################
	##################科  室################
	########################################
	/**
	 * 科室列表
	 **/
	public function office_list(){
		if(!isset($this->data['page'])||empty($this->data['page'])||$this->data['page']<=0){
			$this->data['page'] = 1;
		}
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		$page = $this->data['page'];
		$biz_id = $this->data['biz_id'];
		$where = ' 1 = 1 ';

		if (isset($this->data['dname'])||!empty($this->data['dname'])) {
			$rs = Db::table('doctor')->field('id')->where(['biz_id'=>$this->data['biz_id'],'name'=>$this->data['dname']])->find();
			if(!$rs){
				$this->success('没有该医生数据！');
			}
			$where .= ' and doctor_id like \'%,'.$rs['id'].',%\'';
		}
		if (isset($this->data['kname'])||!empty($this->data['kname'])) {
			$rs = Db::table('hospitalpoi')->field('poiid')->where(['biz_id'=>$this->data['biz_id'],'poiname'=>$this->data['kname']])->find();
			if(!$rs){
				$this->success('没有该科室数据！');
			}
			$where .= ' and poi_id like \'%,'.$rs['poiid'].',%\'';
		}

		$toCount = Db::table('hospital_office')->where(['biz_id'=>$biz_id])->where($where)->count();
		$list = Db::table('hospital_office')->where(['biz_id'=>$biz_id])->where($where)->limit(($page-1)*10,10)->order('id desc')->select();
		if($toCount<=0){
			$this->success('没有数据！',['toCount'=>$toCount]);
		}
		$lists = [];
		foreach ($list as $key => $value) {
			$value['doctor'] = Db::table('doctor')->where('id in(0'.$value['doctor_id'].'0)')->select();
			$lists[] = $value;
		}
		$poi = [];
		foreach ($lists as $key => $value) {
			$value['hospitalpoi'] = Db::table('hospitalpoi')->where('poiid in(0'.$value['poi_id'].'0)')->select();
			$poi[] = $value;
		}
		$toPage = ceil($toCount/10);
		$this->success('success',['toPage'=>$toPage,'toCount'=>$toCount,'list'=>$poi]);
	}
	/**
	 * 科室详情
	 **/
	public function office_info(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if (!isset($this->data['id'])||empty($this->data['id'])) {
			$this->error('缺少参数[id]');
		}
		$list = Db::table('hospital_office')->where(['biz_id'=>$this->data['biz_id'],'id'=>$this->data['id']])->find();
		if(!$list){
			$this->success('没有该科室数据！');
		}
		$list['doctor'] = Db::table('doctor')->where('id in(0'.$list['doctor_id'].'0)')->select();
		$list['hospitalpoi'] = Db::table('hospitalpoi')->where('poiid in(0'.$list['poi_id'].'0)')->select();
		$this->success('success',$list);
	}
	/**
	 * 科室删除
	 **/
	public function office_del(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if (!isset($this->data['id'])||empty($this->data['id'])) {
			$this->error('缺少参数[id]');
		}
		Db::table('hospital_office')->where(['id'=>$this->data['id'],'biz_id'=>$this->data['biz_id']])->delete();
		$this->success('删除成功！');
	}
	/**
	 * 科室更新
	 **/
	public function office_update(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		if (!isset($this->data['id'])||empty($this->data['id'])) {
			$this->error('缺少参数[id]');
		}
		$data = $this->data;
		$data['update_time'] = time();
		if (!isset($this->data['name'])||empty($this->data['name'])) {
			$this->error('科室名称不能为空！');
		}
		if (!isset($this->data['poi_id'])||empty($this->data['poi_id'])) {
			$this->error('请选择门诊部！');
		}
		Db::table('hospital_office')->where(['id'=>$this->data['id'],'biz_id'=>$this->data['biz_id']])->update($data);
		$this->success('更新成功！');
	}
	/**
	 * 科室添加
	 **/
	public function office_add(){
		if (!isset($this->data['biz_id'])||empty($this->data['biz_id'])) {
			$this->error('缺少参数[biz_id]');
		}
		$data = $this->data;
		$data['create_time'] = time();
		if (!isset($this->data['name'])||empty($this->data['name'])) {
			$this->error('科室名称不能为空！');
		}
		if (!isset($this->data['poi_id'])||empty($this->data['poi_id'])) {
			$this->error('请选择门诊部！');
		}
		if(Db::table('hospital_office')->where(['biz_id'=>$this->data['biz_id'],'name'=>$this->data['name']])->find()){
			$this->success('该科室已存在！');
		}
		Db::table('hospital_office')->insert($data);
		$this->success('添加成功！');
	}

	public function test(){
		var_dump(Db::table('default_roster')->find());
	}
}
